import express, { Router } from "express"
import { Application } from "express"

export const router = Router()

import "./src/controller/LoginController";

export class App {

    private app: Application
    private port: number

    constructor(port: number) {
        this.app = express()
        this.port = port
        this.initMiddleware()
        this.runServer()
    }
    private initMiddleware() {
        this.app.use(express.json())
        this.app.use(router)
    }
    private runServer() {
        const SERVER_PORT = this.port
        this.app.listen(SERVER_PORT, () => {
            console.log(`${new Date()} server run success! at: http://localhost:${SERVER_PORT}`)
        })
    }
}
